package serveur;

import java.net.*;

import java.sql.SQLException;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.io.*;
import mappingBD.*;

public class Reception implements Runnable {

	private Socket socket;
	public boolean authentifier = false;
	public Thread t2;

	public Reception(Socket s) {
		socket = s;
	}

	public void run() {

		while (true) {
			try {
				InputStream in = socket.getInputStream();
				ObjectInputStream objectInput = new ObjectInputStream(in);
				Object requeteRecu = (Object) objectInput.readObject();
				if (requeteRecu != null) {
					System.out.println("Vient de recevoir un object");
					ServeurBD serveurBD = new ServeurBD();
					serveurBD.executerRequeteServeur(requeteRecu);
				}

			} catch (Exception e) {

				System.err.println("Le Client ne repond pas !");
				break;
			}
		}

	}
}